[ Home ] [ Authors ] [ Index ] [ Abbreviations ] [ Key bindings ]

The Console and ConsoleText Classes

The Console class, derived from Edit, is a top-level window that provides an interface to the Tcl interpreter. The help window gives additional information.

You may create an instance of the Console class as follows:

::tycho::Console .e
.e centerOnScreen

ConsoleText Class

The top-level Console class window is implemented by packing into it a megawidget that implements the console itself. This megawidget, the ConsoleText class, can be used stand-alone inside any other widget or window. For example, a graphics window could contain a console subwindow.

We can create an instance of the ConsoleText megawidget in its own top-level window as follows:

::tycho::TopLevel .t
::tycho::ConsoleText .t.t
.t.t printPrompt ""
pack .t.t
.t centerOnScreen
Notice that you can enter Tcl, Itcl, Tk, and Itk commands into the text window. Also notice that the "printPrompt" method was used above to create the first prompt. To delete the above example:
delete object .t
ConsoleText has a number of options. For example:
::tycho::TopLevel .p
::tycho::ConsoleText .p.t \
    -width 60 \
    -scrollbar 0 \
    -height 20 \
    -text "My own welcome message\n"
pack .p.t
.p.t printPrompt ""
.p centerOnScreen
There are a large number of public methods for ConsoleText. See the class documentation. To delete the above example:
delete object .p


Copyright © 1996, The Regents of the University of California. All rights reserved.
Last updated: 96/04/09, comments to: eal@eecs.berkeley.edu